package pref.junx.flybird.activity.event_info;

import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import pref.junx.flybird.R;
import pref.junx.flybird.activity.main.NewMainActivity;
import pref.junx.flybird.base.BaseActicvitylhy;
import pref.junx.flybird.tools.JumpUtil;
import pref.junx.flybird.tools.TimeChange;


/**
 * Created by 半生瓜 on 2017/8/7.
 */

public class Event_Info_Actvity extends BaseActicvitylhy<Event_Info_Presenter, Event_Info_Model> implements Event_Info_Conteact.View {

    TextView tv_title,tv_zone,TV_time,TV_context,finish_send_msg,DELETE_send_msg;
    String title,zone,context;
    int time,id;
    @Override
    public int getLayoutId() {
return R.layout.wacth_msg_incloud_layout;    }

    @Override
    public void initview() {
        finish_send_msg=(TextView)findViewById(R.id.finish_send_msg) ;
        DELETE_send_msg=(TextView)findViewById(R.id.DELETE_send_msg) ;
        tv_title=(TextView)findViewById(R.id.tv_title) ;
        tv_zone=(TextView)findViewById(R.id.tv_zone) ;
        TV_time=(TextView)findViewById(R.id.TV_time) ;
        TV_context=(TextView)findViewById(R.id.TV_context) ;
        finish_send_msg.setOnClickListener(this);
        DELETE_send_msg.setOnClickListener(this);
    }

    @Override
    public void processClick(View view) {
       switch (view.getId()){
           case R.id.finish_send_msg:
               finish();break;
           case R.id.DELETE_send_msg:
               presenter.delete(id);
       }
    }


    @Override
    public void init() {
        Intent intent = getIntent();
        title = intent.getStringExtra("title");
        zone = intent.getStringExtra("zone");
        time = intent.getIntExtra("time",0);
        context = intent.getStringExtra("context");
        id = intent.getIntExtra("id",0);
        tv_title.setText(title);
        tv_zone.setText(zone);
        TV_time.setText(TimeChange.stampToDate(time));
        TV_context.setText(context);
    }





    @Override
    public void success() {

    }

    @Override
    public void result(String a) {

    }

    @Override
    public void susses() {
        t.show_l("删除成功");
        NewMainActivity.newMainActivity.finish();
        JumpUtil.to(c,NewMainActivity.class);
        finish();
    }

    @Override
    public void fail() {
        t.show_l("删除失败");
        NewMainActivity.newMainActivity.finish();
        JumpUtil.to(c,NewMainActivity.class);
        finish();
    }
}


